package cn.chengpengper.provider;

import cn.chengpengper.rpc.provider.common.scanner.RpcServiceScanner;
import cn.chengpengper.rpc.provider.common.server.base.BaseServer;
import lombok.extern.slf4j.Slf4j;
/**
 * @author chengpeng.hu
 */
@Slf4j
public class RpcSingleServer extends BaseServer {

    public RpcSingleServer(String serverAddress,
                           String registryAddress,
                           String registryType,
                           String scanPackage,
                           String reflectType,
                           String registryLoadBalanceType,
                           int heartbeatInterval,
                           int scanNotActiveChannelInterval,
                           boolean enableResultCache,
                           int resultCacheExpire,
                           int corePoolSize,
                           int maximumPoolSize
    ) {
        //调用父类构造方法
        super(serverAddress, registryAddress, registryType, reflectType, registryLoadBalanceType, heartbeatInterval, scanNotActiveChannelInterval, enableResultCache, resultCacheExpire, corePoolSize, maximumPoolSize);
        try {
            this.handlerMap = RpcServiceScanner.doScanWithRpcServiceAnnotationFilterAndRegistryService(this.host, this.port, scanPackage, registryService);
        } catch (Exception e) {
            log.error("RPC Server init error", e);
        }
    }

}
